<?php

use \Welcomescreen\Agavi\Action;

class Frontend_DeliverTemplateResourceAction extends Action\FrontendBaseAction {
	public function executeRead(AgaviWebRequestDataHolder $rd) {
		return 'Success';
	}
	
	public function validateRead(AgaviWebRequestDataHolder $rd) {
		$template = $this->getContext()->getModel('TemplateManager')->getTemplate($rd->getParameter('templateName'));
		$filePath = AgaviConfig::get('org.welcomescreen.system.template_dir') . '/' . $template->getDirectory() . '/' . $rd->getParameter('file');
		if(is_readable($filePath)) {
			$this->setAttribute('filePath', $filePath);
			return true;
		}
		return false;
	}
}

?>